package com.jjyd.crlp.domain.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.joda.time.LocalDateTime;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

/**
 * 用户信息表
 */
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Data
@EntityListeners(AuditingEntityListener.class)
@Table(name = "users")
public class Users {

    /**
     * id主键，自动递增
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Integer id;

    /**
     * 微信昵称
     */
    @Column(name = "nick_name",columnDefinition = "varchar(255) COMMENT '昵称'")
    private String nickName;

    /**
     * 头像链接
     */
    @Column(name = "avatar_url",columnDefinition = "varchar(255) COMMENT '头像链接'")
    private String avatarUrl;


    /**
     * 是否删除，默认false
     */
    @Column(name = "remove",nullable = false,columnDefinition = "bit COMMENT '是否删除，默认false'")
    private Boolean remove = false;

    /**
     * 创建时间
     */
    @Column(name = "create_time",columnDefinition = "DATETIME COMMENT '创建的时间'")
    @CreatedDate
    private LocalDateTime createTime;

    /**
     * 最后一次更新时间
     */
    @Column(name = "update_time",columnDefinition = "DATETIME COMMENT '更新时间'")
    @LastModifiedDate
    private LocalDateTime updateTime;
}
